This report visualizes data on oil spills in California recorded in 2008 in the Oil Spill Prevention and Response (OSPR) Incident Tracking database. An oil spill incident in this dataset is defined as “a discharge or threatened discharge of petroleum or other deleterious material into the waters of the state.”
Citation: Oil Spill Incident Tracking [ds394], 2009-07-23. 2008 Edition.
Read in data
oil_raw_sf <- read_sf(here('data', 'ds394', 'ds394.shp'))
oil_sf <- oil_raw_sf %>%
janitor::clean_names()
counties_sf <- read_sf(here('data/counties/CA_Counties_TIGER2016.shp'))
counties_subset_sf <- counties_sf %>%
janitor::clean_names() %>%
select(county_name = name, land_area = aland)
Set coordinate system
# st_crs(oil_sf) # EPSG is 4269
#
# st_crs(counties_subset_sf) # EPSG is 4326
### Projections are different. To align them, we take the CA county projection and apply it to the oil spill data.
oil_4326_sf <- st_transform(oil_sf, st_crs(counties_subset_sf))
Plot with tmap
tmap_mode(mode = 'view')
## tmap mode set to interactive viewing
tm_shape(counties_subset_sf) +
tm_borders() +
tm_fill('land_area',
title = "Land Area (meters squared)",
palette = 'BuGn') +
tm_borders(col = 'black') +
tm_shape(oil_4326_sf) +
tm_dots(col = 'darkslateblue')
## Warning: One tm layer group has duplicated layer types, which are omitted. To
## draw multiple layers of the same type, use multiple layer groups (i.e. specify
## tm_shape prior to each of them).